$(function(){
	$("#cancleBut").click(function(){
		parent.$('#dlg').window('close');
		parent.$(document.body).remove()
	});
	var codelength=$('#username').width();
	$('#username').validatebox({
	    required: true,
	    tipPosition:'top',
	    deltaX:codelength/4
	});
	$('#birthdate').datebox({  
		   // required:true  
	}); 
	if($("#birth").val()!=''){
//		var time=Common.formatterBirthdate($("#birth").val());
		$('#birthdate').datebox('setValue',$("#birth").val());
	}
	$('#phone').validatebox({
	    required: true,
	    validType: 'mobile',
	    tipPosition:'top',
	    deltaX:codelength/4
	});
	var ismok=[{"id":"1","text":'是'},{"id":'0',"text":'否'}];
	$("#issmoke").combobox({
		 data:ismok,
		 valueField:'id',
		 textField:'text',
		 panelHeight:'60',
		 onSelect:function(record){
			 $("#smoke").val(record.id);
		 }
	});
	//提交表单
	$("#submitBut").click(function(){
		$("#form").form('submit',{
			url:'/user/updateUserInfo',
			onSubmit:function(){
		        return $(this).form('validate');
		    },
		    success:function(data){
		    	var jdata=$.parseJSON(data); 
		        if(jdata.code==200){
		        	$.messager.alert('成功','修改成功','info',function(){
		        		parent.$('#dlg').window('close');
		        		window.parent.refreshTab("用户信息");
		        	});
		        }
		        else{
		        	$.messager.alert('失败',jdata.msg,'error');
		        }
		    }
		});
	})
})